package com.example.blog_system_ssm.service;

import com.example.blog_system_ssm.entity.ArticleEntity;
import com.example.blog_system_ssm.entity.vo.ArticleEntityVO;
import com.example.blog_system_ssm.mapper.ArticleMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public int add(ArticleEntity articleEntity){
        return articleMapper.add(articleEntity);
    }

    public ArticleEntity  getDetailByIdAndUid(Integer id, Integer uid){
        return articleMapper.getDetailByIdAndUid(id,uid);
    }

    public int update(ArticleEntity articleEntity){
        return articleMapper.update(articleEntity);
    }

    public ArticleEntityVO getDetail(Integer id){
        return articleMapper.getDetail(id);
    }

    public int addRCount(Integer id){
        return articleMapper.addRCount(id);
    }

    public List<ArticleEntity> getArtListByUid(Integer id){
        return articleMapper.getArtListByUid(id);
    }

    public int delArt(Integer id,Integer uid){
        return articleMapper.delArt(id,uid);
    }

    public List<ArticleEntity> getArtListByPage(Integer pageSize,Integer offset){
        return articleMapper.getArtListByPage(pageSize,offset);
    }

    public Integer getPageCount(){
        return articleMapper.getPageCount();
    }

    public List<ArticleEntity> getMyArtListByPage(Integer pageSize, int offset, int uid) {
        return articleMapper.getMyArtListByPage(pageSize,offset,uid);
    }

    public int getPageCountByUser(Integer uid) {
        return articleMapper.getPageCountByUser(uid);
    }

    public int getInterviewCountByName(int uid) {
        return articleMapper.getInterviewCountByName(uid);
    }
}
